using System;
using System.Collections;



namespace WebApplication
{
	[Serializable]
	public class PrivateCompanies : ICollection
	{
		public ArrayList  _aPrivates;	// JoeB made public so serialized

		public PrivateCompany this [int index]   // indexer declaration
		{ 
			get
			{
				return (PrivateCompany) _aPrivates[index];
			}

			set
			{
				_aPrivates[index] = value;
			}
		}

		public PrivateCompany this [string sName]   // indexer declaration
		{ 
			get
			{
				foreach (PrivateCompany company in _aPrivates)
				{
					if ((company.NickName == sName) || (company.Name == sName))
						return company;
				}

				return null;
			}

		}


		public void CopyTo(Array a, int index)
		{
			_aPrivates.CopyTo(a, index);
		}
		public object SyncRoot
		{
			get{return this;}
		}
		public bool IsSynchronized
		{
			get{return false;}
		}

		public int Count
		{
			get
			{
				return _aPrivates.Count;
			}
		}

		public PrivateCompanies ()
		{
			_aPrivates = new ArrayList ();
		}

		public void Add (System.Object PrivateCompany)
		{
			_aPrivates.Add (PrivateCompany);
		}

		public void Add (PrivateCompany Private)
		{
			_aPrivates.Add (Private);
		}

		public void Remove (PrivateCompany Private)
		{
			_aPrivates.Remove (Private);
		}

		// IEnumerable Interface Implementation:

		public IEnumerator GetEnumerator() // non-IEnumerable version
		{
			return _aPrivates.GetEnumerator ();
		}

		IEnumerator IEnumerable.GetEnumerator() // IEnumerable version
		{
			//			return (IEnumerator) new PrivateEnumerator(this);
			return _aPrivates.GetEnumerator ();
		}
	}

	[Serializable]
	public class PrivateCompany
	{
		private int _lastBid;

		public int LastBid
		{
			get
			{
				return _lastBid;
			}
			set
			{
				_lastBid = value;
			}
		}

		private string _name;

		public string Name
		{
			get
			{
				return _name;
			}
			set
			{
				_name = value;
			}
		}

		private int _income;

		public int Income
		{
			get
			{
				return _income;
			}
			set
			{
				_income = value;
			}
		}


		private int _cost;

		public int Cost
		{
			get
			{
				return _cost;
			}
			set
			{
				_cost = value;
			}
		}

		private string _home;

		public string Home
		{
			get
			{
				return _home;
			}
			set
			{
				_home = value;
			}
		}

		private string _nickName;

		public string NickName
		{
			get
			{
				return _nickName;
			}
			set
			{
				_nickName = value;
			}
		}


		public PrivateCompany ()  // default cons
		{
			_lastBid = 0;
		}

	}

}
